<%@page import="java.awt.print.Printable"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<html>
<head>
<title>_调拨单审核</title>
<script type="text/javascript">
	$(function() {
		$("#reason").val('${auditInfo.info}');
	});
	
	function audit(auditType){
	
	    var reason = $("#reason").val().trim();
		if (auditType == 'notpass') { //审核不通过，验证审核意见是否填写
			if (reason == "" || reason == null) {
				alert("审核驳回，需要填写审核意见！");
				$("#reason").focus();
				return;
			}
		}
		
		$("#auditType").val(auditType);
		
		$("#inputForm").submit();
	   
	}

</script>
</head>

<body>

	<div style="height: 10px;"></div>
	<!-- 调拨申请数据 -->
	
	<table id="contentTable" class="table  table-bordered table-condensed">
	    <thead>
			<th style="vertical-align: middle; color: white;" colspan="5" bgcolor="#8EB4CB">调拨申请数据</th>
		</thead>
		<thead><tr>
		    <th style="width: 80px;">调拨单</th>
		    <th style="width: 80px;">调出仓库</th>
			<th style="width: 80px;">调入仓库</th>
			<th style="width: 80px;">申请人</th>
			<th style="width: 80px;">申请时间</th>
		</tr></thead>
		 <tr>
	       <td>${allot.allotCode}</td>
	       <td>${allot.outstorage.groupName}</td>
	       <td>${allot.instotrage.groupName}</td>
	       <td>${allot.requester.realname}</td>
	       <td>${allot.requestTime}</td>
		 </tr>
	</table>
	
	<table id="contentTable" class="table  table-bordered table-condensed">
	    <thead>
			<th style="vertical-align: middle; color: white;" colspan="4" bgcolor="#8EB4CB">调拨明细</th>
		</thead>
		<thead><tr>
		    <th style="width: 80px;">商家</th>
		    <th style="width: 80px;">sku编码</th>
			<th style="width: 80px;">调拨数量</th>
			<th style="width: 80px;">当前库存量</th>
		</tr></thead>
		<c:forEach  items="${itemList}" var="item">
			 <tr>
		       <td>${item.customerCode}</td>
		       <td>${item.sku}</td>
		       <td>${item.allotNum}</td>
		       <td>${item.curNum}</td>
			 </tr>
		</c:forEach>
	</table>
	
   <form id="inputForm" action="${ctx}/allotAudit/audit" method="post" class="form-horizontal">
	<!-- 审核操作-->
	<table class="table table-striped table-bordered table-condensed" style="width: 100%; margin-top: 0px; " >
		<thead>
			<th style="vertical-align: middle; color: white;" colspan="4" bgcolor="#8EB4CB">审核操作</th>
		</thead>
		<tr></tr>
		<tr>
		  <td>审核意见： 
			<textarea rows="3" id="reason" name="reason" style="width:790px;" maxlength="100"></textarea>
			<input type="hidden" name="auditType" id="auditType"/>
			<input type="hidden" name="allotCode"  value="${allot.allotCode}"/>
			<input type="hidden" name="allotId"  value="${allot.id}"/>
		  </td>
		</tr>
		<tr>
			<td style="vertical-align: middle;">审核处理：
			<c:if test="${allot.status eq '1' }">
			   <input class="btn btn-primary" type="button" value="审核通过" onclick="audit('pass');"    />&nbsp;	
			   <input class="btn btn-danger"  type="button" value="审核驳回" onclick="audit('notpass');" />&nbsp;
			</c:if>
			</td>
		</tr>
	</table>
	</form>
	
	<div class="form-actions">
		<a href="${ctx}/allotAudit" class="btn " >返回</a>
	</div>


</body>
</html>
